package design.mode.composite.item2;

/**
 * @author ZhongMingde on 2021/11/4
 */

public class File extends FileSystemNode {

  public File(String path) {
    super(path);
  }

  @Override
  public int countNumOfFiles() {
    return 1;
  }

  @Override
  public long countSizeOfFiles() {
    java.io.File file = new java.io.File(path);
    if (!file.exists()) {
      return 0;
    }
    return file.length();
  }
}
